// Wrigglers Squared //--------------------------------------------- (define "GridDirection" ) (define "Score4" (do (forEach Site (sites Occupied by:#1) (if (> 3 (count Pieces #1 in:(sites Around (site) "GridDirection"))) (set State at:(site) 0) (set State at:(site) 1) ) ) next:(do (and { (remember Value 0) (remember Value 0) (forEach Group "GridDirection" // if:(is #1 (who at:(to))) (if (no Pieces in:(intersection (sites) (sites State 1))) (remember Value (count Sites in:(sites)) ) ) ) }) next:(set Var "TopValue" (max (values Remembered)) (then (forget Value (max (values Remembered)) (then (set Score #1 (* (var "TopValue") (max (values Remembered))) (then (forget Value All) ) ) ) ) ) ) ) ) ) (define "AddOrPass" (or { (move Add (piece (id "Disc" Mover)) (to (sites Empty) if:(> 3 (count Pieces Mover in:(sites Around (to) "GridDirection"))) ) (then (set Var "Added" 1)) ) (move Pass) // without this there are obscure forced moves... }) ) //----------------------------------------------- // Main routine (game "Wrigglers Squared" (players 2) (equipment { (board use:Vertex) (piece "Disc" Each) }) (rules (play (if (= 1 (var "Added")) (or { "AddOrPass" (forEach Piece (if (< 2 (count Pieces Mover in:(sites Around (from) "GridDirection"))) (move Remove (from) (then (set Var "Added" 0)) )) Mover ) }) "AddOrPass" (then ("Score4" Mover)) ) ) (end (if (all Passed) { (if (>= (score Mover) (score Next)) (result Mover Win) ) } (result Next Win) ) ) ) ) //------------------------------------------------- // Options (define "GridDirection" ) (option "Board" args:{ } { (item "9" <(square 9)> "Order 9, Square Ortho-Grid")** (item "13" <(square 13)> "Order 13, Square Ortho-Grid") (item "19" <(square 19)> "Order 19, Square Ortho-Grid") } ) //--------------------------------------------- (metadata (info { (description "Wrigglers Squared is an adaptation of Wrigglers to a Square board. Wrigglers is a game that allows a minimal amount of self-removal, and has a goal of maximizing the product of one's largest 2 groups. The rules are very simple and the actions of the players highly independent, except for blocking by site occupation. However, the goal and the difficulty of modifying one's groups make the game challenging and removals allow for end-game turnarounds. Removal is only allowed where a player has committed to the removal on a previous turn by placing a stone that overclouds an existing piece. This destroys the group's scoring potential, but allows the overclouded piece to be removed, potentially dividing the group in a way the increases its potential to score. With multiplicative scoring, two equal sized groups score far more than a single group with the same number of pieces. But if there is a 3rd group available, the benefit might be much less.") (rules "Goal:Score the product of the sizes of your two largest chains. Highest score wins. In case of a tie, the last to play wins. Chains are a series of adjacent like-colored stones with no branching. Play: Boards starts empty. The darker color starts. On a turn the moving player does one of these actions: - Place one of their stones onto an empty site adjacent to no more than 2 of their stones, or - Remove one of their stones that is adjacent to more than two of their stones. Otherwise he passes. The game ends when both players pass. ") (id "1970") (version "1.3.12") (classification "experimental") (author "Dale W. Walton") (credit "Dale W. Walton") (date "06-04-2022") } ) (graphics { (player Colour P1 (colour 229 92 0)) (player Colour P2 (colour Cream)) (board Style Graph) (board StyleThickness InnerEdges .2) (board StyleThickness OuterEdges .2) (board StyleThickness InnerVertices .5) (show Edges Diagonal ) (piece Foreground "Disc" state:1 image:"square.svg" fillColour:(colour 0 0 0 50) scale:0.4) // (show Piece State) } ) (ai "Wrigglers Squared_ai" ) )